#ifndef WEBSERVER_H
#define WEBSERVER_H
#include "HeaderParse.h"

class HeaderParse;
class FileInfo;

class WebServer : public TcpServer
{
public:
    WebServer(short port, int maxlisten);
    virtual ~WebServer();
    virtual void onAccept(Clientinfo *info);
    bool doGet(int clentsock, HeaderParse &Hparse);
    bool doPost(int clientsock, HeaderParse &Hparse);

private:
    void sendHeader(int clientsock, FileInfo &HInfo);
    void notFound(int clientsock);
    bool sendFile(int clientsock, const char *Path);
    void notImplement(int clientsock);
};

#endif //WEBSERVER_H